//
//  responseResult.m
//  school
//
//  Created by wangweike on 15-1-13.
//  Copyright (c) 2015年 learnDrive. All rights reserved.
//

#import "responseResult.h"
@implementation responseResult
-(id)initWithResult:(NSDictionary*)dic isCorrect:(BOOL)iscorrect
{
    self=[super init];
    if (self) {
        self.isCorrect=iscorrect;
        if (iscorrect)                //requsetFinshed
        {
            NSString * status=dic[@"Status"];
            
            if ([status isEqual:@"Fail"]) {
                self.erroMessage=dic[@"Message"];
                self.flag=FAILED;
            }else if([status isEqual:@"Error"])
            {
                self.erroMessage=@"系统异常,请稍后尝试!";
                self.flag=FAILED;
                NSLog(@"%@",dic[@"Message"]);
                
            }else if ([status isEqual:@"Success"]) {
                if (dic[@"Result"]==nil) {
                    self.erroMessage=@"网络异常";
                    self.flag=FAILED;
                }else
                {
                    self.DataResult=dic[@"Result"];
                    self.flag=OK;
                }
            }else
            {
                self.erroMessage=@"系统异常,请稍后尝试!";
                self.flag=FAILED;
            }
        }
        else                         //requestFailed
        {
            self.erroMessage=@"requestFailed";
        }
    }
    
    return self;
}

@end
